<?php
/**
 * User: itimphp
 * Date: 6/6/12
 * Time: 9:00 PM
 */
function sendSuccessEmail($from, $to, $reply_to, $subject, $body)
{
	require_once('class.phpmailer.php');

	$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
	$mail->IsSendmail(); // telling the class to use SendMail transport

	try {
		$mail->SetFrom($from);
		$mail->AddReplyTo($reply_to);
		$mail->AddAddress($to);
		$mail->Subject = $subject;
		$mail->Body = $body;
		$mail->Send();

		// Log Send Email
	} catch (phpmailerException $e) {
		echo $e->errorMessage(); //Pretty error messages from PHPMailer
		// Log PHPMailer exception
	} catch (Exception $e) {
		echo $e->getMessage(); //Boring error messages from anything else!
		// Log anything else exceptions!
	}
}